package com.xlx.openLink.enums;

import org.apache.commons.lang3.StringUtils;

public enum DevTypeEnum {


    SwitchType("SwitchType", "交换机"),

    ComputerType("ComputerType", "PC主机"),

    RouterSwitchType("RouterSwitchType", "路由交换机"),

    RouterType("RouterType", "路由器"),

    CameraType("CameraType", "摄像头"),

    UnkownType("UnkownType", "未知类设备");


    private DevTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private String code;
    private String desc;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static DevTypeEnum getByCode(String codeType) {
        if (StringUtils.isBlank(codeType)) {
            return null;
        }

        for (DevTypeEnum result : values()) {
            if (codeType.equalsIgnoreCase(result.getCode())) {
                return result;
            }
        }
        return null;
    }

}
